<template>
	<div class="Infocontainer">
		<h1 class="Newsname">{{newsInfo.title}}</h1>
		<p class="newSub">
			<span>发布时间：{{newsInfo.add_time | dataFormat}}</span>
			<span>点击:{{newsInfo.click}} 次</span>
		</p>
		<hr>
		<div class="content" v-html="newsInfo.content"></div>
		<comment :id="id"></comment>
	</div>
</template>

<script>
	import comment from '../subcomponent/comment.vue'
	export default{
		data() {
			return {
				id:this.$route.params.id,
				newsInfo: []
			}
		},
		created() {
			this.getNewsInfo()
		},
		methods:{
			getNewsInfo(){
				this.$http.get('http://www.liulongbin.top:3005/api/getnew/'+this.id).then(function(data){
					this.newsInfo=data.body.message[0]
				})
			}
		},
		//加载评论模块
		components:{
			comment
		}
	}
</script>

<style>
	.Infocontainer{
		padding: 1px 4px;
	}
	.Newsname{
		font-size: 16px;
		color: red;
		margin: 10px 3px;
	}
	.newSub{
		color: skyblue;
		font-size: 13px;
		display: flex;
		justify-content: space-between;
	}
</style>
